package com.ice.day726.thread;

import lombok.extern.slf4j.Slf4j;

/**
 * @Author ice2020x
 * @Date 2022-07-27 12:41
 * @Description: 唤醒睡眠的线程
 */
@Slf4j
public class ThreadTest5 {

    public static void main(String[] args) {

        Thread t = new Thread(()->{
            log.debug("enter sleep...");
            try {
                Thread.sleep(2000);
            } catch (InterruptedException e) {
                log.debug("wake up...");
                e.printStackTrace();
            }

            log.debug("执行下面逻辑...");
        });

        t.start();
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        log.debug("interrupt...");
        t.interrupt();
    }
}
